package com.ddwl.common.constant;

import com.ddwl.common.exception.CommonException;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author Fu Zhaohui
 * @date 2017/3/20
 */
public interface BaseEnum {

    @AllArgsConstructor
    @Getter
    enum HeadEnum {
        AK("ak", "用户登录唯一token"),
        DK("dk", "设备唯一识别号（微信小程序这个为openId）"),
        PK("pk", "产品(mall)"),
        PT("pt", "设备类型(web,pc,wx)"),
        ;
        private String code;
        private String desc;
    }

    /**
     * 平台枚举 pk参数
     */
    @AllArgsConstructor
    @Getter
    enum ProductEnum {
        CLOTHES("clothes", "一点", true),
        MALL("mall", "58度商城小程序", false),
        FENXIAO("fenxiao", "58度分销", true),
        ZHENYU("zhenyu", "贞雨", true),
        CONSOLE("console", "管理系统", false),
        CMS("cms", "客户管理", true),
        TERMINAL("terminal", "门店智慧终端", true),
        IOT("iot", "多典物联", true),
        API("api", "微服务内部API", false),
        WBM("wbm", "五八马小程序", false),
        WBM_OFFICE("wbm_office", "五八马公众号", false),
        SHOP_CONSOLE("shop_console", "商户管理后台", false),
        BYTE_DANCE("byte_dance", "字节跳动", false),
        ;

        private String name;
        private String desc;
        private Boolean app;

        public static ProductEnum getProduct(String name) {
            for (ProductEnum product : values()) {
                if (product.getName().equals(name)) {
                    return product;
                }
            }
            throw new CommonException(String.format("%s 非法参数", name));
        }
    }

    /**
     * 删除标识枚举
     */
    @AllArgsConstructor
    @Getter
    enum DflagEnum {

        NOT_DELETE(0, "未删除标识"),
        DELETED(1, "已删除标识");

        private Integer code;
        private String desc;
    }

    /**
     * 状态枚举
     */
    @AllArgsConstructor
    @Getter
    enum StatusEnum {

        ENABLE(1, "启用"),
        DISABLE(0, "停用");

        private Integer code;
        private String desc;
    }

    @AllArgsConstructor
    @Getter
    enum ReadEnum {

        READED(1, "已读"),
        UNREAD(0, "未读");

        private Integer code;
        private String desc;
    }

    @AllArgsConstructor
    @Getter
    enum UseEnum {

        UN_USE(0, "未使用"),
        USED(1, "已使用"),
        EXPIRED(2, "已过期");

        private Integer code;
        private String desc;
    }


    @AllArgsConstructor
    @Getter
    enum WxAppId {

        MALL("wxd802d1d1d0c430c1", "多典商城"),
        WBM("wx0c5c9457ca38c329", "五八马"),
        WBM_APP("wx9b0c368346c69495", "五八马App"),
        WBM_OFFICE("wx70769315f612d01b", "五十八度公众号"),
        ;
        private String code;
        private String desc;
    }

    @Getter
    @AllArgsConstructor
    enum  ApplyEnum {
        CRE( 0, "提交审批"),
        PRE( 10, "审批中"),
        SUCCEED( 20, "审批通过"),
        FILL( 30, "审批失败"),
        ;
        private Integer code;
        private String name;
    }

    /**
     * 字节跳动
     */
    @AllArgsConstructor
    @Getter
    enum ByteDanceAppId {
        /**
         * 小程序
         */
        MICRO_APP("tt3fe54958a0dd2ff901", "字节跳动小程序"),
        ;
        private String code;
        private String desc;
    }

}
